import React from 'react';
import styles from './index.less';
import { connect } from 'dva';

/* eslint react/no-multi-comp:0 */
@connect(({ count, example }) => ({ count, temp: example }))
class CountApp extends React.Component {
    render() {
        const { count, temp, dispatch } = this.props;
        return (
            <div className={styles.normal}>
                <div className={styles.record}>Highest Record: {count.record}</div>
                <div className={styles.current}>{count.current}</div>
                <div className={styles.button}>
                    <button onClick={() => dispatch({ type: 'count/add' })}>+</button>
                    {temp.a + temp.b}
                </div>
            </div>
        );

    }
}

// const mapStateToProps = state => ({ count: state.count, temp: state.example });

// export default connect(mapStateToProps)(CountApp);
export default CountApp;